/**
 * losenote.com Inc.
 * Copyright (c) 2013-2013 All Rights Reserved.
 */
package com.losenote.web.ct;

import java.util.Date;

import com.losenote.model.OperateContext;
import com.losenote.orm.MessageDO;
import com.losenote.web.form.MessageForm;

/**
 * 
 * @author danjingyu
 * @version $Id: MessageCt.java, v 0.1 2013-12-1 下午5:09:58 danjingyu Exp $
 */
public class MessageCt {

    /**
     * 转换器
     * 
     * @param answerForm
     * @return
     */
    public static MessageDO fromForm(MessageForm messageForm, OperateContext context) {
        MessageDO messageDO = new MessageDO();
        messageDO.setMessage(messageForm.getMessage());
        messageDO.setCreator(String.valueOf(context.getUserInfo().getId()));
        messageDO.setRelType(messageForm.getRelType());
        messageDO.setRelId(messageForm.getRelId());
        messageDO.setFatherId(messageForm.getLastId());
        messageDO.setGmtCreate(new Date());
        return messageDO;
    }

}
